package day8;

/**
 * @author oldliu
 * @since 1.0
 */
public class Depositer extends Thread {
    private final Account ac;

    public Depositer(String name, Account ac) {
        super(name);
        this.ac = ac;
    }

    @Override
    public void run() {
        while (true){
            ac.deposit(3000);
            System.out.println(this.getName()+"存钱成功，现在yu额是："+ac.getMoney()+"元");
            synchronized (ac){
                ac.notifyAll();
            }
            try {
                Thread.sleep(1500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
